import requests

url = "https://zwfw.guizhou.gov.cn/ytbase/system/default.aspx"

headers = {
  'accept': 'application/json, text/javascript, */*; q=0.01',
  'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
  'cache-control': 'no-cache',
  'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
  'origin': 'https://zwfw.guizhou.gov.cn',
  'pragma': 'no-cache',
  'priority': 'u=1, i',
  'referer': 'https://zwfw.guizhou.gov.cn/520300/index.html',
  'sec-ch-ua': '"Chromium";v="142", "Microsoft Edge";v="142", "Not_A Brand";v="99"',
  'sec-ch-ua-mobile': '?0',
  'sec-ch-ua-platform': '"Windows"',
  'sec-fetch-dest': 'empty',
  'sec-fetch-mode': 'cors',
  'sec-fetch-site': 'same-origin',
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0',
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'YJSESSIONID=80281A22970B4D08A33B6BCA43B4F13E; ASP.NET_SessionId=dgptmd55rrf3my23p3vzfy45; Ytian_CK=browse_guid=9B7EAE080C389CD1B078EA14DFF998E0BB66DEBADFBFB33D320026F0E6A9BB8CC52811D8CA772A57&browse_guid_login=EA4C12357EB2F4F5AE4AFDFA8009BF98CC1F578B18D17AAFAA3DA1BA5B089B45133CAAE86372BF0FFDE0A7682510E571105962337F24ECDE5D7071F777C8F570CFF22BBBEC6E0810DC3D65EA375CEB857C9CE2394BD5910850523948ACB69548F9A0E02BD989A036'
}
region_code = {
    "遵义市": "520300",
    "红花岗区": "520302",
    "汇川区": "520303",
    "桐梓县": "520322",
    "绥阳县": "520323",
    "正安县": "520324",
    "道真县": "520325",
    "务川县": "520326",
    "凤冈县": "520327",
    "湄潭县": "520328",
    "余庆县": "520329",
    "习水县": "520330",
    "赤水市": "520381",
    "新蒲新区": "520383"
}
for k,v in region_code.items():
    payload = "yt_out_lay=1&ClassName=ZnzwSvr.page.OrgManageAction.GetOrgInfoList&DB_Conn=ZWBSDB&areaCode={}".format(v)

    response = requests.request("POST", url, headers=headers, data=payload).json()

    # if '不动产' or '公积金' in response['data']
    for i in response['data']:
        if '不动产' in i['Orgname']:
            print(k+':'+i['Orgname'])
